from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from time import sleep
from options import options

driver = webdriver.Chrome(options=options)
driver.get(r'https://www.baidu.com/')
sleep(3)
print('当前的窗口句柄:')
print(driver.current_window_handle)
driver.find_element(By.LINK_TEXT,'hao123').click()
print('当前的窗口句柄:')
print(driver.current_window_handle)
print('所有的句柄:')
print(driver.window_handles)
sleep(2)
driver.switch_to.window(driver.window_handles[0])
sleep(3)
driver.switch_to.window(driver.window_handles[1])
sleep(3)